//
//  HNRootTabBarViewController.m
//  HappyNews
//
//  Created by baiping on 15/12/27.
//  Copyright © 2015年 bai wang. All rights reserved.
//

#import "HNRootTabBarViewController.h"
#import "HNReadViewController.h"
#import "HNHomeViewController.h"
#import "HNMeViewController.h"
#import "HNRadioViewController.h"
#import "HNNewsViewController.h"
@interface HNRootTabBarViewController ()

@end

@implementation HNRootTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 添加 导航控制器 和根视图控制器
    [self addNavigationVC];
    
    
    
    
}

- (void)addNavigationVC{
    
   UINavigationController *homeNaVC = [self addNaVCRootVCWithClassName:@"HNHomeViewController" title:@"首页"];
    
   UINavigationController *newsNaVC = [self addNaVCRootVCWithClassName:@"HNNewsViewController" title:@"新闻"];
    
   UINavigationController *meNaVC = [self addNaVCRootVCWithClassName:@"HNMeViewController" title:@"我"];

   UINavigationController *radioNaVC = [self addNaVCRootVCWithClassName:@"HNRadioViewController" title:@"视频"];
    
   UINavigationController *readNaVC = [self addNaVCRootVCWithClassName:@"HNReadViewController" title:@"阅读"];
    
   self.viewControllers = @[homeNaVC, newsNaVC, meNaVC, radioNaVC, readNaVC];
    
}

- (UINavigationController *)addNaVCRootVCWithClassName:(NSString *)className title:(NSString *)title{

    
    UIViewController *rootVC = [[NSClassFromString(className) alloc]init];
    
    UINavigationController *naVC = [[UINavigationController alloc]initWithRootViewController:rootVC];
    
    naVC.title = title;
    
    rootVC.navigationItem.title = title;
    
    return naVC;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

    
    
}



@end
